try:
    try:
        num = int(input("请输入一个整数："))
        result = 10 / num
    except ZeroDivisionError:
        print("内部处理：不能除以零！")
except ValueError:
    print("外部处理：请输入有效的整数！")


class NegativeNumberError(Exception):
    """负数错误"""
    pass
 
def check_positive(num):
    if num < 0:
        raise NegativeNumberError("数字不能为负数！")
 
try:
    check_positive(-5)
except NegativeNumberError as e:
    print(f"捕获异常：{e}")


try:
    num = int(input("输入数字："))
    result = 10 / num
except ValueError:
    print("请输入有效数字！")
except ZeroDivisionError:
    print("不能除以零！")


try:
    num = int(input("输入数字："))
    result = 10 / num
except (ValueError, ZeroDivisionError):
    print("发生 ValueError 或 ZeroDivisionError！")


try:
    num = int(input("请输入数字："))
    result = 10 / num
except ZeroDivisionError:
    print("不能除以零！")
except ValueError:
    print("请输入有效数字！")
except Exception as e:
    print(f"其他异常：{e}")